package com.atguigu.guli.service.statistics.controller;


import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.statistics.entity.vo.DailyVo;
import com.atguigu.guli.service.statistics.service.DailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2021-08-16
 */
@RestController
@RequestMapping("/admin/statistics/daily")
public class DailyController {

    @Autowired
    DailyService dailyService;
    //根据日期获取信息
    @GetMapping("/getChart")
    public R getChart(@RequestParam("start")String start,
                      @RequestParam("end")String end){
        DailyVo dailyVo = dailyService.getStatistics(start,end);
        return R.ok().data("data",dailyVo);
    }

    //生成报表信息测试
    @GetMapping("/creat")
    public R creatChart(@RequestParam("start")String start){
        dailyService.genDaily(start);
        return R.ok();
    }
}

